<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  const integerBreak = (n) => {
    let res = 0;
    for (let i = 1; i <= n - 1; i++) {
      res = Math.max(res, i * (n - i), i * integerBreak(n - i));
    }
    return res;
  };
  console.log(integerBreak(n = 2));
</script>

</html>